/*
 Navicat Premium Data Transfer

 Source Server         : 192.168.31.97
 Source Server Type    : MySQL
 Source Server Version : 80035 (8.0.35-0ubuntu0.20.04.1)
 Source Host           : 192.168.31.97:3306
 Source Schema         : super_bot

 Target Server Type    : MySQL
 Target Server Version : 80035 (8.0.35-0ubuntu0.20.04.1)
 File Encoding         : 65001

 Date: 05/01/2024 18:17:55
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for drawing
-- ----------------------------
DROP TABLE IF EXISTS `drawing`;
CREATE TABLE `drawing` (
  `drawing_id` bigint NOT NULL AUTO_INCREMENT COMMENT '绘图ID',
  `user_id` bigint NOT NULL COMMENT '所属用户',
  `prompt` text NOT NULL COMMENT '提示词',
  `original_url` varchar(200) DEFAULT NULL COMMENT '上传图',
  `generate_url` varchar(200) DEFAULT NULL COMMENT '生成图',
  `is_public` tinyint NOT NULL DEFAULT '0' COMMENT '是否公开',
  `created_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  `env` tinyint NOT NULL DEFAULT '0',
  PRIMARY KEY (`drawing_id`),
  KEY `drawing_env_index` (`env`),
  KEY `drawing_generate_url_index` (`generate_url`),
  KEY `idx_created_time` (`created_time`),
  KEY `idx_is_public` (`is_public`),
  KEY `idx_update_time` (`update_time`),
  KEY `idx_user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of drawing
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for exchange
-- ----------------------------
DROP TABLE IF EXISTS `exchange`;
CREATE TABLE `exchange` (
  `exchange_id` bigint NOT NULL AUTO_INCREMENT COMMENT '兑换码ID',
  `exchange_code` varchar(8) NOT NULL COMMENT '兑换码',
  `frequency` bigint NOT NULL COMMENT '兑换码所含Ai币',
  `created_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  PRIMARY KEY (`exchange_id`),
  UNIQUE KEY `exchange_code` (`exchange_code`),
  KEY `idx_created_time` (`created_time`),
  KEY `idx_exchange_code` (`exchange_code`),
  KEY `idx_frequency` (`frequency`),
  KEY `idx_update_time` (`update_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of exchange
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for orders
-- ----------------------------
DROP TABLE IF EXISTS `orders`;
CREATE TABLE `orders` (
  `orders_id` varchar(100) NOT NULL,
  `user_id` bigint NOT NULL,
  `product_id` bigint NOT NULL,
  `product_name` varchar(50) NOT NULL,
  `product_price` double NOT NULL,
  `state` tinyint NOT NULL,
  `created_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `pay_time` datetime DEFAULT NULL,
  `frequency` bigint NOT NULL,
  `reason_failure` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`orders_id`),
  KEY `orders_product_id_index` (`product_id`),
  KEY `orders_state_index` (`state`),
  KEY `orders_user_id_index` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of orders
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for personality
-- ----------------------------
DROP TABLE IF EXISTS `personality`;
CREATE TABLE `personality` (
  `personality_id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `user_id` bigint NOT NULL COMMENT '所属用户',
  `model` varchar(50) NOT NULL COMMENT '模型名称',
  `top_p` tinyint NOT NULL,
  `max_tokens` bigint NOT NULL COMMENT '上传图',
  `temperature` tinyint NOT NULL COMMENT '生成图',
  `open_key` varchar(255) NOT NULL COMMENT 'chatgpt密钥',
  `open_ai_url` varchar(255) NOT NULL COMMENT 'chatgpt请求地址',
  `questions` text NOT NULL COMMENT '问题',
  `answer` text NOT NULL COMMENT '回答',
  `speed` bigint NOT NULL COMMENT '回复速率',
  `created_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  PRIMARY KEY (`personality_id`),
  KEY `personality_user_id_index` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of personality
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for product
-- ----------------------------
DROP TABLE IF EXISTS `product`;
CREATE TABLE `product` (
  `product_id` bigint NOT NULL AUTO_INCREMENT,
  `product_name` varchar(100) NOT NULL,
  `frequency` bigint NOT NULL,
  `product_price` double NOT NULL,
  `created_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`product_id`),
  KEY `product_product_name_index` (`product_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of product
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for sd_model
-- ----------------------------
DROP TABLE IF EXISTS `sd_model`;
CREATE TABLE `sd_model` (
  `sd_model_id` bigint NOT NULL AUTO_INCREMENT,
  `model_name` varchar(100) NOT NULL,
  `text_name` varchar(200) NOT NULL,
  `created_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`sd_model_id`),
  KEY `sd_model_model_name_text_name_index` (`model_name`,`text_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of sd_model
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for star
-- ----------------------------
DROP TABLE IF EXISTS `star`;
CREATE TABLE `star` (
  `star_id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `user_id` bigint NOT NULL COMMENT '所属用户',
  `issue` longtext NOT NULL COMMENT '问题',
  `answer` longtext NOT NULL COMMENT '答案',
  `created_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  PRIMARY KEY (`star_id`),
  KEY `idx_created_time` (`created_time`),
  KEY `idx_update_time` (`update_time`),
  KEY `idx_user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of star
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for ts_user
-- ----------------------------
DROP TABLE IF EXISTS `ts_user`;
CREATE TABLE `ts_user` (
  `user_id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `nick_name` varchar(180) DEFAULT NULL COMMENT '昵称',
  `open_id` varchar(180) DEFAULT NULL COMMENT '微信用户标识',
  `email` varchar(200) DEFAULT NULL,
  `type` enum('ADMIN','USER') NOT NULL DEFAULT 'USER',
  `avatar` varchar(200) DEFAULT NULL COMMENT '用户头像',
  `expiration_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '过期时间',
  `created_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  PRIMARY KEY (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of ts_user
-- ----------------------------
BEGIN;
INSERT INTO `ts_user` (`user_id`, `nick_name`, `open_id`, `email`, `type`, `avatar`, `expiration_time`, `created_time`, `update_time`) VALUES (1, NULL, NULL, 'simon9520@qq.com', 'USER', NULL, '2024-01-05 11:42:50', '2024-01-05 11:42:48', '2024-01-05 11:42:48');
INSERT INTO `ts_user` (`user_id`, `nick_name`, `open_id`, `email`, `type`, `avatar`, `expiration_time`, `created_time`, `update_time`) VALUES (2, 'wang', NULL, 'cnwangyongchen@163.com', 'USER', '/avatar/c2a4f124-f3fe-492b-8c6c-0dcb5bb81a05.png', '2024-01-05 13:42:48', '2024-01-05 13:42:48', '2024-01-05 14:05:55');
COMMIT;

-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
  `user_id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `open_id` varchar(180) DEFAULT NULL COMMENT '微信用户标识',
  `avatar` varchar(200) DEFAULT NULL COMMENT '用户头像',
  `user_name` varchar(100) DEFAULT NULL COMMENT '用户微信昵称',
  `email` varchar(200) DEFAULT NULL,
  `password` varchar(255) DEFAULT NULL,
  `type` enum('ADMIN','USER') NOT NULL DEFAULT 'USER',
  `frequency` bigint NOT NULL DEFAULT '0' COMMENT 'Ai币',
  `is_sign_in` tinyint NOT NULL DEFAULT '0' COMMENT '是否签到',
  `created_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  PRIMARY KEY (`user_id`),
  KEY `idx_created_time` (`created_time`),
  KEY `idx_frequency` (`frequency`),
  KEY `idx_open_id` (`open_id`),
  KEY `idx_update_time` (`update_time`),
  KEY `user_email_password_index` (`email`,`password`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of user
-- ----------------------------
BEGIN;
INSERT INTO `user` (`user_id`, `open_id`, `avatar`, `user_name`, `email`, `password`, `type`, `frequency`, `is_sign_in`, `created_time`, `update_time`) VALUES (1, NULL, NULL, NULL, 'cnwangyongchen@qq.com', '62d18b4acbd214908e4ed68dea06ae90', 'ADMIN', 1000000, 0, '2024-01-03 14:01:45', '2024-01-03 15:14:11');
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
